﻿namespace KeRui.Kernel
{
    using KeRui.Common;
    using KeRui.Common.DEncrypt;
    using System;
    using System.Web;

    public class Software
    {
        private static string Domain = "07ly.com";
        public static string ChineseName = "KeRui 旅游信息发布平台";
        public static string ClientUrl = ("http://www." + Domain + "/client");
        public static string CompanyName = "苏州科瑞信息技术有限公司";
        public static string CompanyUrl = ("http://www." + Domain);
        public static string Database = "Microsoft SQL Server";

        public static string ForumUrl = ("http://www." + Domain + "/index.php?m=bbs");
        public static string FullName = "KeRui Travel Management System";
        public static string HelpUrl = ("http://www." + Domain + "/help");
        public static string Name = "KeRui TMS";
        public static string ServiceUrl = ("http://www." + Domain + "/");
        public static string Version = "2.0.0";

        public static bool Activated()
        {
            return true;
            //return Activated(HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToString(), HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"], ConfigHelper.GetConfigString("ProductSN"));
        }

        internal static bool Activated(string domain, string ip, string code)
        {
            return true;
            //Exception exception;
            //try
            //{
            //    if (code == "")
            //    {
            //        return false;
            //    }
            //    string strContent = "";
            //    try
            //    {
            //        strContent = DESEncrypt.Decrypt(code, L());
            //    }
            //    catch (Exception exception1)
            //    {
            //        exception = exception1;
            //        return false;
            //    }
            //    string[] strArray = Utils.SplitString(strContent, S());
            //    if (ip != strArray[1])
            //    {
            //        return false;
            //    }
            //    string[] strArray2 = Utils.SplitString(domain, strArray[0]);
            //    int length = strArray2.Length;
            //    if (strArray2[length - 1].ToLower() == "")
            //    {
            //        return true;
            //    }
            //}
            //catch (Exception exception2)
            //{
            //    exception = exception2;
            //    return false;
            //}
            //return false;
        }

        private static string L()
        {
            return "KeRui.!Q1a@W2s#E3d$R4f%T5g^Y6h&U7j*I8k(O9l)P0;_{-'.LIULIU";
        }

        private static string S()
        {
            return "|1qaz!QAZ2wsx@WSX3edc#EDC4rfv_RFV5tgb%TGB6yhn_YHN7ujm&UJM8ik,_IK<9ol.(OL>0p;/_P:?-_'_{_=]_}_||";
        }
    }
}

